
package com.sxit.ecwx.core.utils;

import java.util.Properties;


import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.UUIDHexGenerator;

/**
 * 
 * 功能说明:UUID 生成工具类 
 * 创建时间: 2011 12 2 13:52:20
 * @author admin
 */
public class UUIDGenerator {
	private static int count=0;
	public static String javaId(){
		count++;
		String resultId=""+System.currentTimeMillis()+""+count;
		if(count>=90){
			count=0;
		}
		return resultId;
	}
	/**
	 * hibernate id生成器
	 * @return
	 */
	public static String hibernateUUID(){
//		Properties props = new Properties();
//		props.setProperty("separator", "");
		IdentifierGenerator gen = new UUIDHexGenerator();
		String id = (String) gen.generate(null, null);		
		return id;
	}
	public static void main( String[] args ) throws Exception {
		String id=javaId();
		System.out.println(id);;
	}
}
